/** Observer class ----------------------------------------------**/
/** Define the basic class of the different observers, to get
informations from the observables
**/

#ifndef OBSERVER_H_
#define OBSERVER_H_

#include <list>
#include <iterator>
#include <algorithm>
#include <boost/shared_ptr.hpp>

namespace BPL
{
class Observable;

class Observer
{
 public:
    virtual ~Observer();

    virtual void notify(Observable* obs);

    void addObs(Observable* obs);
    void delObs(Observable* obs);

    void delAllObs();

protected:
    typedef std::list<Observable*>::iterator iterator;
    typedef std::list<Observable*>::const_iterator const_iterator;

    std::list<Observable*> mpt_list;
};

class Observable
{
 public:
    virtual ~Observable();

    void addObs(Observer* obs);
    void delObs(Observer* obs);

    void delAllObs();

 protected:
    typedef std::list<Observer*>::iterator iterator;
    typedef std::list<Observer*>::const_iterator const_iterator;

    std::list<Observer*> mpt_list;

    virtual void _notify();

};
}

#endif


